package com.example.hzq.zqb.model;

import com.example.hzq.zqb.bean.EnterpriseBean;
import com.example.hzq.zqb.bean.CampusShopBean;
import com.example.hzq.zqb.bean.CommentBean;
import com.example.hzq.zqb.bean.GoodsBean;
import com.example.hzq.zqb.bean.GoodsdetailBean;
import com.example.hzq.zqb.bean.GrandBean;
import com.example.hzq.zqb.bean.GrandgoodsBean;
import com.example.hzq.zqb.bean.LoginBean;
import com.example.hzq.zqb.bean.MyshopBean;
import com.example.hzq.zqb.bean.NewsBean;
import com.example.hzq.zqb.bean.OrderBean;
import com.example.hzq.zqb.bean.UserBean;
import com.example.hzq.zqb.service.Service;

import java.util.List;

import retrofit2.Call;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory;

/**
 * Created by hzq on 2017/7/6.
 */

public class Model {
    private Retrofit retrofit;
    private String BASEURL="http://www.hongyudasha.com/zqb/";
    public Model() {
        retrofit =new Retrofit.Builder().baseUrl(BASEURL).addConverterFactory(ScalarsConverterFactory.create()).addConverterFactory(GsonConverterFactory.create()).build();
    }
    //登录
    public Call<LoginBean> login(String name, String pwd) {
        Service service =retrofit.create(Service.class);
        return service.login(name,pwd);

    }
    //获取校内兼职全部商品列表
    public Call<List<CampusShopBean>> info(int page){
        Service service =retrofit.create(Service.class);
        return service.info(page);
    }
    //校园兼职-获取校内兼职各板块商品列表
    public Call<List<CampusShopBean>> getGoodsTypeInfo(int page,int tid){
        Service service =retrofit.create(Service.class);
        return service.getGoodsTypeInfo(page,tid);
    }
    //校园兼职-修改浏览量
    public Call<String> changeHint(int id){
        Service service =retrofit.create(Service.class);
        return service.changeHint(id);
    }
    //校园兼职-获取校内兼职商品评价列表
    public Call<List<CommentBean>> getCommentList(int page, int gid){
        Service service =retrofit.create(Service.class);
        return service.getCommentList(page,gid);
    }
    //校园兼职-获取校内兼职商品属性
    public Call<GoodsdetailBean> getGoodsDetailInfo(int gid){
        Service service =retrofit.create(Service.class);
        return service.getGoodsDetailInfo(gid);
    }
    //校园兼职-获取确认订单数据
    public Call<OrderBean> subGoodsOrder(int gid, int uid, int aType, int bType){
        Service service =retrofit.create(Service.class);
        return service.subGoodsOrder(gid, uid, aType, bType);
    }
    //校园兼职-获取企业兼职列表
    public Call<List<EnterpriseBean>> getEnterpriseList(int page){
        Service service =retrofit.create(Service.class);
        return service.getEnterpriseList(page);
    }
    public Call<MyshopBean> getShopName(int uid){
        Service service =retrofit.create(Service.class);
        return service.getShopName(uid);
    }
    public Call<List<GrandBean>> typeList(int page, int aid){
        Service service =retrofit.create(Service.class);
        return service.typeList(page, aid);
    }
    public Call<List<GrandgoodsBean>> goodsList(int page, int typeid){
        Service service =retrofit.create(Service.class);
        return service.goodsList(page, typeid);
    }
    public Call<List<CommentBean>> getCommentList(int page){
        Service service =retrofit.create(Service.class);
        return service.getCommentList(page);
    }
    //攒攒钱-分期小助手获取已经完成购买的商品列表
    public Call<List<GoodsBean>> getBuyGoodsList(int page, int uid){
        Service service =retrofit.create(Service.class);
        return service.getBuyGoodsList(page, uid);
    }
    //攒攒钱-分期小助手添加分期商品
    public Call<String> changeStatus(int addId){
        Service service =retrofit.create(Service.class);
        return service.changeStatus(addId);
    }
    //攒攒钱-分期小助手获取已完成添加的商品列表
    public  Call<List<GoodsBean>> getBuyFinishAdd(int page, int uid){
        Service service =retrofit.create(Service.class);
        return service.getBuyFinishAdd(page, uid);
    }
    //攒攒钱-回滚已经添加为目标的商品
    public Call<String> revert(){
        Service service =retrofit.create(Service.class);
        return service.revert();
    }
    //消息-获取消息列表
    public Call<List<NewsBean>> getNews(int page, int uid, int tid){
        Service service =retrofit.create(Service.class);
        return service.getNews(page, uid, tid);
    }
    public Call<UserBean> userInfo(int uid){
        Service service =retrofit.create(Service.class);
        return service.userInfo(uid);
    }
}
